package com.nanhai.buddhist.college.module.collegebase.dal.mysql.studentrewardpunish;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.studentrewardpunish.vo.StudentRewardPunishExportReqVO;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.studentrewardpunish.vo.StudentRewardPunishPageReqVO;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.studentrewardpunish.StudentRewardPunishDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 奖励惩罚表 Mapper
 *
 * @author AKai
 */
@Mapper
public interface StudentRewardPunishMapper extends BaseMapperX<StudentRewardPunishDO> {

    default PageResult<StudentRewardPunishDO> selectPage(StudentRewardPunishPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentRewardPunishDO>()
                .likeIfPresent(StudentRewardPunishDO::getName, reqVO.getName())
                .eqIfPresent(StudentRewardPunishDO::getType, reqVO.getType())
                .orderByDesc(StudentRewardPunishDO::getCreateTime));
    }

    default List<StudentRewardPunishDO> selectList(StudentRewardPunishExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StudentRewardPunishDO>()
                .likeIfPresent(StudentRewardPunishDO::getName, reqVO.getName())
                .eqIfPresent(StudentRewardPunishDO::getType, reqVO.getType())
                .orderByDesc(StudentRewardPunishDO::getCreateTime));
    }

}
